<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>无极菜单</title>
  </head>
  <body>
    <div id="menus"></div>
  </body>
  <script src="https://releases.jquery.com/git/jquery-git.js"></script>
  <script src="./menu.js"></script>
  <script>
    let dats = [
      { id: "1", name: "1" },
      { id: "1-1", name: "1-1", parentId: "1" },
      { id: "1-2", name: "1-2", parentId: "1" },
      { id: "1-3", name: "1-3", parentId: "1" },
      { id: "1-3-1", name: "1-3-1", parentId: "1-3" },
      { id: "1-3-2", name: "1-3-2", parentId: "1-3" },
      { id: "1-3-2-1", name: "1-3-2-1", parentId: "1-3-2" },
      { id: "1-3-2-2", name: "1-3-2-2", parentId: "1-3-2" },
      { id: "2", name: "2" },
      { id: "2-1", name: "2-1", parentId: "2" },
      { id: "2-1-1", name: "2-1-1", parentId: "2-1" },
      { id: "2-1-1-1", name: "2-1-1-1", parentId: "2-1-1" },
      { id: "2-1-1-1-1", name: "2-1-1-1-1", parentId: "2-1-1-1" },
      { id: "2-1-1-1-2", name: "2-1-1-1-2", parentId: "2-1-1-1" },
      { id: "2-1-1-1-3", name: "2-1-1-1-3", parentId: "2-1-1-1" },
      { id: "2-1-1-1-4", name: "2-1-1-1-4", parentId: "2-1-1-1" },
      { id: "2-1-1-2", name: "2-1-1-2", parentId: "2-1-1" },
      { id: "3", name: "3" },
      { id: "3-1", name: "3-1", parentId: "3" },
      { id: "3-2", name: "3-2", parentId: "3" },
      { id: "3-3", name: "3-3", parentId: "3" },
      { id: "3-3-1", name: "3-3-1", parentId: "3-3" },
      { id: "3-3-2", name: "3-3-2", parentId: "3-3" },
      { id: "3-3-2-1", name: "3-3-2-1", parentId: "3-3-2" },
      { id: "3-3-2-2", name: "3-3-2-2", parentId: "3-3-2" },
    ];
    const params = {
      elem: "menus",
      data: dats,
      direction: "right",
      gaps: 10,
      click: function (data, dom) {
        console.log("data , dom: ", data, dom);
      },
      hover: function (data, dom) {
        dom.css("color", "red");
      },
      leave: function (data, dom) {
        dom.css("color", "black");
      },
    };
    const menuClass = new VerticalLine(params);
    menuClass.initVerticalMenus();
  </script>
</html>
<style>
  * {
    margin: 0;
    padding: 0;
  }
  ol,
  ul,
  li {
    list-style: none;
    width: fit-content;
    cursor: pointer;
    position: relative;
    color: black;
  }
  #menus {
    width: fit-content;
    margin-top: 200px;
    margin-left: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
  }
  .wrapper-menulist-root {
    position: absolute;
    top: 0px;
    display: none;
    opacity: 0;
    width: max-content;
  }
</style>
